<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?><!DOCTYPE html>
<html lang="ru">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="icon" href="/favicon.ico">
        
        <meta http-equiv="Refresh" content="<?php echo $reload_period; ?>">

        <title><?php echo (isset($title)?$title:$this->config->item('app_title')); ?></title>

        <!-- Bootstrap core CSS -->
        <link href="/assets/css/bootstrap.min.css" rel="stylesheet">
        
        <link href="/assets/css/jquery.lightbox-0.5.css" rel="stylesheet">
        
        <!-- Custom styles for this template -->
        <link href="/assets/css/charts.css" rel="stylesheet">
        <link href="/assets/css/datepicker.css" rel="stylesheet" type="text/css"/>
        
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <div class="container-fluid">
            <div class="row">
                <div id="chart-header">
                    <div id="chart-subheader" class="col-sm-4">
                        <h4><a href="/"><span class="glyphicon glyphicon-home"> </span></a><small><a href="/"> на главную</a></small></h4>
                    </div>
                    <div id="chart-subheader-right" class="col-sm-8 text-right">
                        Последнее обновление: <?php echo date("d.m.Y H:i:s"); ?>
                        <br>
                        Следующее обновление: <?php echo date("d.m.Y H:i:s",time()+$reload_period); ?>
                    </div>
                </div>
            </div>
        </div> <!-- /container -->
        <div class="container-fluid">
            <div class="row">
                <div id="chart-content">
                    <?php echo $content; ?>
                </div>
            </div>
        </div> <!-- /container -->
        
        <div class="container">
            <div class="row" style="padding-top: 25px;">
                <div id="chart-form" class="well well-sm">
                    <form class="form-inline" role="form" id="formchart">
                        <div class="form-group">
                            <label class="hidden-sm">Построить за</label>
                            <select class="form-control input-sm" name="formperiod">
                                <?php 
                                foreach ($this->config->item('form_chart_period') as $key => $value) {
                                    $sel = ((string)$key === @$_GET['formperiod'])?' selected':'';
                                    echo '<option value="'.$key.'"'.  $sel.'>'.$value.'</option>';
                                }
                                ?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="chartDate">c</label>
                            <div class="input-group input-group-sm">
                                <div class="input-group-addon hand" id="dateMinus"><span class="glyphicon glyphicon-chevron-left"></span></div>
                                <input type="datetime" class="form-control" id="chartDate" name="formdate" value="<?php echo empty($_GET['formdate'])?'':$chart_date; ?>">
                                <div class="input-group-addon hand" id="datePlus"><span class="glyphicon glyphicon-chevron-right"></span></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="chartWidth">размер</label>
                            <input type="text" class="form-control input-sm" id="chartWidth" name="formwidth" maxlength="4" placeholder="Ширина" value="<?php echo isset($_GET['formwidth'])?$chart_width:$settings['chart']['width']; ?>">
                            <input type="text" class="form-control input-sm" id="chartHeight" name="formheight" maxlength="4" placeholder="Высота" value="<?php echo isset($_GET['formheight'])?$chart_height:$settings['chart']['height']; ?>">
                        </div>
                        <div class="form-group">
                            <label for="chartOy">maxOy</label>
                            <input type="text" class="form-control input-sm" id="chartOy" name="formmaxoy" placeholder="maxOy" maxlength="8" value="<?php echo !empty($_GET['formmaxoy'])?my_digit_only($_GET['formmaxoy']):''; ?>">
                        </div>
                        <button type="submit" class="btn btn-primary btn-sm" name="submitperiod" tabindex="1">Ok</button>
                    </form>
                </div>
            </div>
        </div> <!-- /container -->
        <div class="clearfix"></div>
        
        <!-- footer -->
        <div class="container">
            <div class="row">
                <br>
            </div>
        </div>
        <!-- to top -->
        <a id="toTop" style="right: -1px; display: none;" class="hand">
            <img id="gh-bti" border="0" width="33" height="76" alt="Scroll to top" src="/images/btt.png" title="К началу страницы">
        </a>

        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="/assets/js/jquery-1.11.1.min.js"></script>
        <!-- Include all compiled plugins (below), or include individual files as needed -->
        <script src="/assets/js/bootstrap.min.js"></script>
        
        <script src="/assets/js/jquery-ui.min.js"></script>
        <script src="/assets/js/jquery.lightbox-0.5.min.js"></script>
        <!-- Charts Script -->
        <script src="/assets/js/charts-script.js"></script>
    </body>
</html>